package request

type Menu struct {
	Pid        uint   `form:"pid" json:"pid" binding:"required"`
	Name       string `form:"name" json:"name" binding:"required"`
	Guard_name string `form:"guard_name" json:"guard_name" binding:"-"`
	Url        string `form:"url" json:"url" binding:"required"`
	Group      string `form:"group" json:"group" binding:"-"`
	Title      string `form:"title" json:"title" binding:"required"`
	Icon       string `form:"icon" json:"icon" binding:"-"`
	Target     string `form:"target" json:"target" binding:"-"`
	Sort       uint   `form:"sort" json:"sort" binding:"required"`
	Menu_type  uint   `form:"menu_type" json:"menu_type" binding:"required"`
	Level      uint   `form:"level" json:"level" binding:"required"`
}

type AddMenu struct {
	Menu
}

func (addMenu AddMenu) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"pid.required":       "父id不能为空",
		"name.required":      "权限名称不能为空",
		"url.required":       "菜单链接不能为空",
		"title.required":     "菜单名称不能为空",
		"sort.required":      "排序字段不能为空",
		"menu_type.required": "菜单类型不能为空",
		"level.required":     "菜单层级不能为空",
	}
}

type Id struct {
	Id uint `form:"id" json:"id" binding:"required"`
}

type EditMenu struct {
	Id
	Menu
}

func (editMenu EditMenu) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required":        "id不能为空",
		"pid.required":       "父id不能为空",
		"name.required":      "权限名称不能为空",
		"url.required":       "菜单链接不能为空",
		"title.required":     "菜单名称不能为空",
		"sort.required":      "排序字段不能为空",
		"menu_type.required": "菜单类型不能为空",
		"level.required":     "菜单层级不能为空",
	}
}

type SetMenuSort struct {
	Id
	Sort uint `form:"sort" json:"sort" binding:"required"`
}

func (setMenuSort SetMenuSort) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required":   "id不能为空",
		"sort.required": "排序字段不能为空",
	}
}

type Del struct {
	Id
}

func (del Del) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required": "id不能为空",
	}
}

// menu_type  menu_type=1 全部 菜单和按钮  menu_type=2 只有菜单
type GetMenuList struct {
	Menu_type uint `form:"menu_type" json:"menu_type" binding:"required"`
}

func (getMenuList GetMenuList) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"menu_type.required": "id不能为空",
	}
}
